
//banner切换事件
EventUtil.addHandler(window,"load",function(){
      var banners=new Array();
      var banner=document.getElementById("banner");
      var currentcount=1;
      for(var i=0;i<3;i++){
      	var img=new Image();
      	img.src="/static/common/img/kz_index_banner"+".jpg";
      	banners.push(img);
      }
      setInterval(function(){
       if(currentcount>=3){
       	currentcount=0;
       }
       console.log(banners[currentcount].src);
       banner.src=banners[currentcount].src;
       currentcount++;

      },4800);
});
//header上的onmouseover效果
 var header=document.getElementsByTagName("header")[0];
 var aspan=header.getElementsByTagName("a");
 console.log(aspan);
EventUtil.addHandler(header,"mouseover",function(){
	header.style.cursor="url(/static/common/img/point.png),auto";
});
for(var i=0;i<aspan.length;i++){
	EventUtil.addHandler(aspan[i],"mouseover",function(){
	this.style.cursor="url(/static/common/img/point.png),auto";
});
}
//header跟随界面滚动
EventUtil.addHandler(window,"scroll",function(){
	var scrolltop;
	var header=document.getElementsByTagName("header")[0];
	var tel=document.getElementById("tel");
	var logo=document.getElementById("logo");
	 if(document.compatMode=="CSS1Compat"){
	 	scrolltop=document.documentElement.scrollTop;
	 }else{
        scrolltop=document.body.scrollTop;
	 }
	 if(scrolltop>0){
	 	header.style.color="black";
	 	header.style.backgroundColor ="white";
        tel.src="/static/common/img\/kz_index_yellowtel.png";
        logo.src="/static/common/img\/kz_index_yellowlogo.png";
        aspan[1].style.visibility="visible";

	 }else{
	 	header.style.color="white";
	 	header.style.backgroundColor ="transparent";
	 	tel.src="/static/common/img\/kz_index_tel.png";
	 	logo.src="/static/common/img\/kz_index_logo.png";
	 	aspan[1].style.visibility="hidden";
	 }
});
var kz_chioce=document.getElementsByClassName("kz_typechioce")[0];
var kz_nav=kz_chioce.getElementsByTagName("nav")[0];
var kz_a=kz_nav.getElementsByTagName("a");
var kz_section=kz_chioce.getElementsByTagName("section");
var currentj;
for(var j=0;j<kz_a.length;j++){
    EventUtil.addHandler(kz_a[j],"mouseover",function(event){
	var _event=EventUtil.getEvent(event);
	var _target=EventUtil.getTarget(_event);
	for(var i=0;i<kz_a.length;i++){
		kz_a[i].style.borderBottom="5px solid rgba(255,138,68,0)";
	}
	_target.style.borderBottom="5px solid rgba(255,138,68,1)";
	if(_target.innerHTML=="热门商圈"){
		kz_section[0].className="kz_show";
		kz_section[1].className="kz_hidden";
		kz_section[2].className="kz_hidden";
	}else if(_target.innerHTML=="团队规模"){
        kz_section[0].className="kz_hidden";
		kz_section[1].className="kz_show";
		kz_section[2].className="kz_hidden";
	}else{
	    kz_section[0].className="kz_hidden";
		kz_section[1].className="kz_hidden";
		kz_section[2].className="kz_showo";

	}
     });
}
//马上找房按钮跳转页面
var findhousebutton=document.getElementsByClassName("kz_navigetor")[0].getElementsByTagName("button")[0];
EventUtil.addHandler(findhousebutton,"click",function(){
	window.location.href="file:///C:/Users/Administrator/Desktop/kz/mainsearch.html";
});
